#!/usr/bin/perl
#
# List the emails of the maintainers for all areas, or all areas
# under some prefix.
# note that database schema is screwy - uses int for maintainer, while
# database is list-of-numbers. So must fetch whole record to get it right.
#
use Counter;

$places = Counter::openfile("places");

$area = shift;
if (!$area) {
    @hasmaint = $places->select("maintainer <> 0");
} else {
    @hasmaint = $places->select("name like '$area%' and maintainer <> 0");
}
for $place (@hasmaint) {
    @maints = split(" ", $place->{maintainer});
    for $maint (@maints) {
	$maintlist{$maint} .= $place->{name};
	$maintlist{$maint} .= " ";
    }
}
$users = Counter::openfile("users");
for $id (keys(%maintlist)) {
    $user = $users->get($id);
    print "$maintlist{$id} <$$user{email}>\n";
}

		    

